package szte.objectorgy.collections;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Static singleton class for serializing a collection.
 * 
 * @author Endre PALATINUS
 */
public class FileWriter {

	public static void write(Iterator<?> it) {

		PrintWriter pw;
		try {
			pw = new PrintWriter(new BufferedWriter(new java.io.FileWriter(
					"kollekcio.txt")));
			
			while (it.hasNext()) {
				pw.println(it.next());
			}

			pw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private FileWriter() {

	}

}
